package marsrovers;

public enum Instruction {
	
	L,
	R,
	M;
	
	// TODO(seshumadhav): Explore ways to eliminate if-else
	public static Instruction toInstruction(String instructionCode) {
		if (instructionCode.equalsIgnoreCase("L")) {
			return Instruction.L;
		} else if (instructionCode.equalsIgnoreCase("R")) {
			return Instruction.R;
		} else if (instructionCode.equalsIgnoreCase("M")) {
			return Instruction.M;
		} else {
			throw new RuntimeException("Invalid instruction code passed");
		}
	}
}
